<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>学生信息管理</title>
<meta name="decorator" content="default"/>
<script src="${ctxStatic}/common/change/change.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	$(document).on("click","#union",function(){
		debugger;
		var obj = {
			id : $.trim($(this).parent().parent().find("td").eq(1).text()),
			stuName : $.trim($(this).parent().parent().find("td").eq(2).text()),
			stuCode : $.trim($(this).parent().parent().find("td").eq(3).text()),
			nation : $.trim($(this).parent().parent().find("td").eq(5).text()),
			birthday : $.trim($(this).parent().parent().find("td").eq(6).text()),
			gender : $.trim($(this).parent().parent().find("td").eq(7).text()),
			schoolName : $.trim($(this).parent().parent().find("td").eq(9).text()),
			stuGrade : $.trim($(this).parent().parent().find("td").eq(10).text()),
			className : $.trim($(this).parent().parent().find("td").eq(11).text()),
			classCode : $.trim($(this).parent().parent().find("td").eq(12).text())
		};
		window.parent.addInfo(obj);
		var index = parent.layer.getFrameIndex(window.name);
		parent.layer.close(index);
	});
});

function page(n,s){
	$("#pageNo").val(n);
	$("#pageSize").val(s);
	$("#searchForm").submit();
    return false;
}

function closeLayer(){
	parent.layer.closeAll();
}

</script>
<style type="text/css">
body{
   padding:10px;
}		
#contentTable td ,#contentTable th{
	text-align: center;
	padding:1px 10px;
}
.minWidth {
	min-width: 177px;
}
</style>
</head>
<body>
	<form:form id="searchForm" modelAttribute="student" action="${ctx}/student/student/getList" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<table class="table table-bordered">
			<tr>
			    <th>姓名:</th>
				<td>
					<form:input path="stuName" class="span2 minWidth" />
				</td>
				<th>性别:</th>
				<td>
					<form:select path="gender" class="span2 minWidth" >
						<form:option value="" label="--请选择--"/>
						<form:options items="${fns:getDictList('sex')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</td>
				<th>学号：</th>
				<td>
					<form:input path="stuCode" class="span2 minWidth" />	
				</td>
			</tr>
			<tr>
			    <th>出生起始日期:</th>
				<td>
					<input name="beginDate" id ="beginDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${student.beginDate}" pattern="yyyy-MM-dd"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
				</td>
				<th>出生截止日期：</th>
				<td colspan = "3">
					<input name="beginDate" id ="beginDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${student.beginDate}" pattern="yyyy-MM-dd"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
				</td>
			</tr>
		</table>
		<div>
			<button id="btnSubmit" class="btn btn-primary" type="submit">查询</button>
			<button  class="btn btn-primary" onclick="closeLayer()" type="button">关闭窗口</button>
		</div>
	</form:form>
	
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed" >
		<thead>
			<tr>
				<shiro:hasPermission name="student:student:edit"><th>操作</th></shiro:hasPermission>
				<th>姓名</th>
				<th>学号</th>
				<th>年龄</th>
				<th>民族</th>
				<th>出生日期</th>
				<th>性别</th>
				<th>入学年份</th>
				<th>学校</th>
				<th>年级</th>
				<th>班级</th>
			</tr>
		</thead>
		<tbody id="tbody">
		<c:forEach items="${page.list}" var="student">
			<tr>
				<td>
					<input type="button" style="border:none;" id="union" value="选择"/>
				</td>
				<td style="display:none">
					${student.id}
				</td>
				<td>
					${student.stuName}
				</td>
				<td>
			        ${student.stuCode}
				</td>
				<td>
					${student.age}
				</td>
				<td>
					${fns:getDictLabel(student.nation,'nation','')}
				</td>
				<td>
					<fmt:formatDate value="${student.birthday}" pattern="yyyy-MM-dd"/>
				</td>
				<td>
				    ${fns:getDictLabel(student.gender,'sex','')}
				</td>
				<td>
					${student.enrtYear}
				</td>
				<td>
					${student.schoolName}
				</td>
				<td>
					${fns:getDictLabel(student.stuGrade,'stu_grade','')}
				</td>
				<td>
					${student.className}
				</td>
				<td style="display:none">
					${student.classCode}
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>